<?php
namespace app\api\model;
use think\Model;
class Gongyingshang extends Model
{
    public function index()
    {   
       
    }
    
    public function getGongyingshang()
    {    
    	$data = [
           'zhuangtai'=>1,
    	];
    	return $gongyingshang = model('gongyingshang')
    	                         ->field('gid,gname,phone,email,dizhi')
    	                         ->where($data)
    	                         ->select();
    }

    public function inserGongyingshang($gname,$phone,$email,$dizhi)
    { 
       $data=[
           'gname'=>$gname,
           'phone'=>$phone,
           'email'=>$email,
           'dizhi'=>$dizhi,
           'zhuangtai'=>1,
       ];
       return $count = model('gongyingshang')->insert($data);
    }
    public function editGongyingshang($gid,$gname,$phone,$email,$dizhi)
    {   
      $count = model('gongyingshang')->where('gid',$gid)->update(['gname'=>$gname,'phone'=>$phone,'email'=>$email,'dizhi'=>$dizhi]);
      return $count;
    }
}